package com.xwtec.strategy;

import java.util.Arrays;

/**
 * @Author: zt
 * @Date: 2021/2/21 14:49
 */
public class Main {
    public static void main(String[] args) {
        Cat[] arr = {new Cat(10, 10), new Cat(7, 7), new Cat(18, 18)};
        SorterComparator<Cat> catSorterComparator = new SorterComparator<>();
//        Dog[] arr = {new Dog(3), new Dog(1), new Dog(-7)};
//        SorterComparator<Dog> dogSorterComparator = new SorterComparator<>();
/*        dogSorterComparator.sort(arr, new Comparator<Dog>() {
            @Override
            public int compare(Dog o1, Dog o2) {
                if (o1.food < o2.food) return -1;
                else if (o1.food > o2.food) return 1;
                else return 0;
            }
        });*/
 /*       dogSorterComparator.sort(arr,(o1,o2)->{
            if (o1.food > o2.food) return -1;
            else if (o1.food < o2.food) return 1;
            else return 0;
        });*/
        catSorterComparator.sort(arr, (o1, o2) -> {
            if (o1.height < o2.height) return -1;
            else if (o1.height > o2.height) return 1;
            else return 0;
        });


        System.out.println(Arrays.toString(arr));
    }

}
